package net.sk.china.front.service.order;

import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import net.sk.china.common.model.order.StoreCart;
import net.sk.china.common.request.PageParamRequest;
import net.sk.china.front.request.order.CartNumRequest;
import net.sk.china.front.request.order.CartRequest;
import net.sk.china.front.request.order.CartResetRequest;
import net.sk.china.front.response.order.CartInfoResponse;

import java.util.List;
import java.util.Map;

/**
 * StoreCartService 接口
 * +----------------------------------------------------------------------
 * | Talk To [ 聊来改善地区金融服务环境，助力企业发展 ]
 * +----------------------------------------------------------------------
 * | Copyright (c) 2018-2024 聊来All rights reserved.
 * +----------------------------------------------------------------------
 * | Licensed ( <a href="http://www.apache.org/licenses/LICENSE-2.0">apache</a> )
 * +----------------------------------------------------------------------
 * | @Author: 聊来 <18970881148@qq.com>
 * +----------------------------------------------------------------------
 * | DateTime: 2024/6/12 17:48
 * +----------------------------------------------------------------------
 */
public interface StoreCartService extends IService<StoreCart> {

    /**
     * 根据有效标识符获取出数据
     * @param pageParamRequest 分页参数
     * @param isValid 是否失效
     * @return {@code PageInfo<CartInfoResponse>}
     */
    PageInfo<CartInfoResponse> getList(PageParamRequest pageParamRequest, boolean isValid);

    /**
     * 新增购物车
     * @param storeCartRequest 新增购物车参数
     * @return {@code Long}
     */
    Long saveCate(CartRequest storeCartRequest);

    /**
     * 删除购物车
     * @param ids 待删除id
     * @return {@code boolean}
     */
    boolean deleteCartByIds(List<Long> ids);

    /**
     * 获取当前购物车数量
     * @param request 请求参数
     * @return Map<String, Long>
     */
    Map<String, Long> getCount(CartNumRequest request);

    /**
     * 修改购物车商品数量
     * @param id 购物车id
     * @param number 数量
     * @return {@code boolean}
     */
    boolean updateCartNum(Integer id, Integer number);

    /**
     * 购物车重选提交
     * @param resetRequest 重选数据
     * @return {@code boolean}
     */
    boolean resetCart(CartResetRequest resetRequest);

    /**
     * 通过id和uid获取购物车信息
     * @param id 购物车id
     * @param uid 用户uid
     * @return {@code StoreCart}
     */
    StoreCart getByIdAndUid(Long id, Integer uid);

}
